package org.wu.framework.lazy.orm.database.sql.expand.database.persistence.method.ddl;

import org.wu.framework.lazy.orm.core.persistence.conf.LazyTableEndpoint;
import org.wu.framework.lazy.orm.core.persistence.conf.LazyColumn;
import org.wu.framework.lazy.orm.core.persistence.conf.LazyColumnIndex;
import org.wu.framework.lazy.orm.core.persistence.conf.LazyTableInfo;
import org.wu.framework.lazy.orm.database.sql.expand.database.persistence.method.LazyOperationMethod;

import java.sql.Connection;
import java.util.List;

/**
 * description ddl 操作的方法
 *
 * @author Jia wei Wu
 * @date 2023/01/15 21:48
 */
public interface LazyDDLOperationMethod extends LazyOperationMethod {

    /**
     * 获取数据库schema
     * @param connection 数据库连接
     * @return 数据库schema
     */
    List<String> findSchemaList(Connection connection);

    /**
     * 查询原始表字段
     *
     * @param connection 数据库连接
     * @param lazyTableEndpoint java 模型
     * @return 表字段
     */
    List<LazyColumn> findTableColumnList(Connection connection,LazyTableEndpoint lazyTableEndpoint);


    /**
     * 查询索引
     *
     * @param connection 数据库连接
     * @param lazyTableEndpoint java 模型
     * @return 表索引
     */
    List<LazyColumnIndex> findTableColumnIndexList(Connection connection,LazyTableEndpoint lazyTableEndpoint);

    /**
     * 查询表信息
     *
     * @param connection        数据库连接
     * @param lazyTableEndpoint java 模型
     * @return 表信息
     */
    List<LazyTableInfo> findTableInfo(Connection connection, LazyTableEndpoint lazyTableEndpoint);


    /**
     * 更新表
     *
     * @param lazyTableEndpoint java 模型
     */
    void alertTable(LazyTableEndpoint lazyTableEndpoint);
}
